//
//  RelationViewController.m
//  Yihubang
//
//  Created by xmy on 16/8/30.
//  Copyright © 2016年 jinghao. All rights reserved.
//

#import "RelationViewController.h"
#import "RelationViewModel.h"
@interface RelationViewController ()
@property (nonatomic, strong) RelationViewModel * viewModel;
@end

@implementation RelationViewController
@synthesize viewModel = _viewModel;
@synthesize mTableView = _mTableView;
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title =@"设定关系";
    [self.viewModel bindTableView:self.mTableView];
     self.viewModel.dataSource =@[@[@"爸妈",@"另一半",@"闺蜜",@"亲戚",@"同学",@"同事",@"朋友",@""]];
//    NSMutableDictionary * dic =[NSMutableDictionary dictionary];
//    [dic setObject:@"" forKey:@"custom"];
    if([[self.params allKeys] containsObject:@"relation"]){
        self.viewModel.relation =self.params[@"relation"];
    }
    [self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(saveRelation)] animated:TRUE];
    //去掉tableView多余的横线
    //    self.mTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    //    self.mTableView.separatorInset=UIEdgeInsetsMake(0,0, 0, 0);//top left bottom right
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)saveRelation{
    [self.viewModel.saveInfoCommend execute:nil];
}

#pragma mark -- getter and setter

- (RelationViewModel *)viewModel{
    if (_viewModel==nil) {
        _viewModel = [[RelationViewModel alloc] initWithViewController:self];
    }
    return _viewModel;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
